import { ADDPERSION } from "../constant";

const initState = [
  { id: 1, name: '林霄', age: 31, like: '前端' },
  { id: 2, name: '王姐', age: 28, like: '林霄' }
]
export default function persionReducer(prevState = initState, action) {
  const { type, payLoad } = action
  let newState = prevState
  switch (type) {
    case ADDPERSION:
      newState = [payLoad, ...prevState]
      break;
    default:
      break;
  }
  return newState
}